package com.sgb.kjwl.view.widget.transport

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.sgb.kjwl.R
import com.sgb.kjwl.model.entity.transport.SingleItemEntity

/**
 * @author: 杨畔
 * @date: 4/5/21 11:46 AM
 * @Description: 物流工作台菜单适配器
 */
class LogisticsWorkbenchMenuAdapter(data: MutableList<SingleItemEntity>) :
        BaseQuickAdapter<SingleItemEntity, BaseViewHolder>(R.layout.item_logistics_workbench_menu, data) {
    override fun convert(helper: BaseViewHolder?, item: SingleItemEntity?) {
        if (item == null) return
        helper?.apply {
            setText(R.id.tv_title, item.leftString)
            setImageResource(R.id.iv_icon, item.leftIcon)
            setVisible(R.id.tv_badge, item.isShowBadge && item.number > 0)
            setText(R.id.tv_badge, if (item.number > item.maxNumber) "${item.maxNumber}.." else "${item.number}")
        }
    }
}